<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/4/8
 * Time: 11:41
 */

use Biz\service\RelatePhotos as sRelatePhotos;
use Doraemon\tools\ActionLog;
use Doraemon\tools\HhzClient;

/**
 * @deprecated
 */
class RelatePhotosAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {

        $wikiId = $this->getRequest()->getQuery('wiki_id', 0);
        $goodsId = $this->getRequest()->getQuery('goods_id', 0);
        $searchType = $this->getRequest()->getQuery('search_type', 1);
        $page = $this->getRequest()->getQuery('page', 1);
        $page = $page < 1 ? 1 : $page;

        if ($goodsId) {
            $list = sRelatePhotos::getPhotosByGid($goodsId, $searchType, $page, $this->uid);
        } else {
            $list = sRelatePhotos::getPhotos($wikiId, $searchType, $page, $this->uid);
        }
        ActionLog::log($this->uid, [
            'goods_id' => $goodsId,
            'page' => $page
        ], ActionLog::BIZ_RELATE_PHOTOS);
        HhzClient::setLogExpose(true);
        $this->setSuccess($list);
    }
}